import {
	GetSearchContent,
} from "@/api/index.js"

//准备actions对象——响应组件中用户的动作
const actions = {
	// 获取搜索单曲内容
	async GetSearchContent(state, key) {
		let info = await GetSearchContent(key)
		state.commit('setSearchContent', info['result']['songs'])
		return info
	},
}
//准备mutations对象——修改state中的数据
const mutations = {
	// 修改搜索的单曲内容
	setSearchContent(state, obj) {
		state.SearchContent = obj
	},
}
//准备state对象——保存具体的数据
const state = {
	SearchContent: [], //搜索的单曲内容
}


export default ({
	state,
	mutations,
	actions,
	namespaced: true,
})
